#!/usr/bin/env python
#-*-encoding:utf-8-*-
'''
Created on 2015年3月30日

@author: chenyongbing
'''
import sys,os,re
#current_dir = os.path.dirname(__file__)
current_dir = os.path.split(os.path.realpath(__file__))[0]

from django import forms
from django.forms.util import ErrorList


class CompAndGroupSelectForm(forms.Form):
#     FieldsDict = {  'device':'设备MAC',
#                     'status':'设备状态',
#                     'version':'设备版本',
#                     'first_online':'首次上线时间',
#                     'last_online':'最后上线时间',
#                     'last_offline':'最后下线时间',
#                     'comp_name':'公司名',
#                     'group_serial_number':'门店编号',
#                     'group_name':'门店名',
#                     'prov':'省份',
#                     'city':'城市',
#                     'dist':'区域'
#                   }
    
    
    Fields = (('comp_name','公司名'),('group_serial_number','门店编号'),('group_name','门店名'),
              ('prov','省份'),('city','城市'),('dist','区域'),
              ('device','设备MAC'),('status','设备状态'),('version','设备版本'),
              ('first_online','首次上线时间'),('last_online','最后上线时间'),('last_offline','最后下线时间'),
              ('white_list','设备白名单'),('black_list','设备黑名单'),
              )
    company = forms.ChoiceField(widget=forms.Select(attrs={'class':'target'}),choices=(('company','请选择公司'),),label=u'公司')
    group = forms.ChoiceField(widget=forms.Select(attrs={'class':'target'}),choices=(('group','请选择门店'),),label=u'门店')
    fields = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple(),choices=Fields,initial=['group_name','device','status'],required=False,label=u'字段选择')



class ExportApOnlineTimeForm(forms.Form):
    company = forms.ChoiceField(widget=forms.Select(attrs={'class':'target'}),choices=(('company','请选择公司'),),label=u'公司')
    group = forms.ChoiceField(widget=forms.Select(attrs={'class':'target'}),choices=(('group','请选择门店'),),label=u'门店')
    province = forms.ChoiceField(widget=forms.Select(attrs={'class':'target'}),choices=(('province','请选择省份'),),label=u'省份')
    city = forms.ChoiceField(widget=forms.Select(attrs={'class':'target'}),choices=(('city','请选择城市'),),label=u'城市')
    dist = forms.ChoiceField(widget=forms.Select(attrs={'class':'target'}),choices=(('dist','请选择区域'),),label=u'区域')
    cate = forms.ChoiceField(widget=forms.Select(attrs={'class':'target'}),choices=(('cate','请选择类别'),),label=u'类别')
    startTime = forms.DateField(input_formats=(("%Y-%m-%d"),),label=u"开始时间",required=False)
    endTime = forms.DateField(input_formats=(("%Y-%m-%d"),),label=u"结束时间",required=False)